package com.example.core.hql;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class HQLInfo implements Cloneable{

    private String selectBlock;

    private String whereBlock;

    private String fromBlock;

    private boolean getCount = false;

    private boolean gettingCount = true;

    private String joinBlock;

    private Class<?> modelClass;

    private String modelName;

    private String modelTable;

    private String orderBy;

    private int pageSize;

    private int pageNum;

    private List<HQLParameter> parameterList = new ArrayList<HQLParameter>();

    public void setParameter(String key, Object object) {
        this.parameterList.add(new HQLParameter(key, object));
    }

    public Object clone() throws CloneNotSupportedException {
        HQLInfo hqlInfo = (HQLInfo) super.clone();
        hqlInfo.parameterList = new ArrayList<HQLParameter>(parameterList);
        return hqlInfo;
    }
}
